//
//  SetViewController.swift
//  SwiftProject
//
//  Created by HBY on 2021/5/6.
//

import UIKit


typealias inputBlock = (_ value:String) -> Void

class SetViewController: UIViewController,UITextFieldDelegate {
    @IBOutlet weak var inputTxt: UITextField!
    
    var block: inputBlock?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "设置"
        
        // Do any additional setup after loading the view.
    }
    
    @IBAction func onclick_submit() {
        if (self.block != nil) {
            self.block!(inputTxt.text ?? "")
        }
    }
    
    func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool{
        let valueStr = textField.text?.appending(string)
        if valueStr!.count > 11 {
            return false
        }
        return true
    }
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     // Get the new view controller using segue.destination.
     // Pass the selected object to the new view controller.
     }
     */
    
}
